home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13879 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: crc-news.doc.ca!usenet
  2. From: Slobodan Celenkovic <Celenkovic.Bob@ic.gc.ca>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Forward declarations: why won't they work?
  5. Date: 27 Mar 1996 21:45:24 GMT
  6. Organization: Industry Canada
  7. Message-ID: <4jcctk$2k9@crc-news.doc.ca>
  8. References: <4ivpp0$iut@hustle.rahul.net>
  9. NNTP-Posting-Host: bouhadrah.mohamed.bsd001.ic.gc.ca
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; U; 16bit)
  14.  
  15. Theodore Sternberg <strnbrg@rahul.net> wrote:
  16. >Forward class declarations only seem to work sometimes.  When they don't 
  17. >work, I get a compiler error to the effect that "struct foo is an 
  18. >imcomplete type".  Can anyone tell me what's going on, i.e. when forward 
  19. >class declarations are and are not possible?
  20.  
  21. They always work. However the class must be defined eventually. Also I 
  22. believe that you can only declare pointers to the class, because pointers 
  23. are of fixed size. If you try to declare a class data member before class 
  24. declaration then the compiler has no clue how much storage space is 
  25. required!
  26.  
  27.  
  28.